﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OrderServe
{
    [Serializable]
    public class Order
    {
        private string id;
        private string customer;
        private string address;
        private string phoneNumber;
        private OrderDetails details;

        public Order()
        {
            this.id = "";
            this.customer = "";
            this.address = "";
            this.phoneNumber = "";
            this.details = new OrderDetails();
        }

        public Order(string id, string customer, string address, string phoneNumber, OrderDetails details)
        {
            this.id = id;
            this.customer = customer;
            this.address = address;
            this.phoneNumber = phoneNumber;
            this.details = details;
        }

        public string Id { get => id; set => id = value; }
        public string Customer { get => customer; set => customer = value; }
        public string Address { get => address; set => address = value; }
        public string PhoneNumber { get => phoneNumber; set => phoneNumber = value; }
        public OrderDetails Details { get => details; set => details = value; }

        public override bool Equals(object? obj)
        {
            Order? order = obj as Order;
            return order != null && order.GetHashCode() == this.GetHashCode();
        }

        public override int GetHashCode()
        {
            return Details.GetHashCode() + id.GetHashCode();
        }

    }
}
